<?php
use common\utils\ToolUtil;
use yii\helpers\Html;
/* @var $this yii\web\View */

$this->title = '添加角色';
$pageSize = \Yii::$app->params['pageSize'];
$limitsJson = \Yii::$app->params['limitsJson'];
?>
<style>
    body{background: #ffffff;}
    .layui-form-label{width:120px;}
</style>
<div class="layui-fluid" style="padding: 30px 0px;">
    <div class="layui-row">
        <form method="post" class="layui-form" action="<?=\yii\helpers\Url::toRoute(['config-base/create'])?>" lay-filter="configbase">

        <!-- <div class="form-group field-configbase-title">
            <label class="control-label" for="configbase-title">配置标题</label>
            <input type="text" id="configbase-title" class="form-control" name="ConfigBase[title]" maxlength="50"> -->


            <div class="layui-form-item">
                <input name="ConfigBase[id]" type="hidden" value="<?=$model->id?>" />
                <input name="_csrfBackend" type="hidden" value="<?=\Yii::$app->request->csrfToken?>" />
                <label for="configbase-title" class="layui-form-label">
                    配置标题
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="configbase-title" name="ConfigBase[title]" value="<?=$model->title?>" placeholder="请输入标题" required="" lay-verify="required"
                           autocomplete="off" class="layui-input">
                </div>
            </div>


            <div class="layui-form-item">
                <label for="configbase-name" class="layui-form-label">
                    配置标识
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="configbase-name" name="ConfigBase[name]" value="<?=$model->name?>" placeholder="请输入标识" required="" lay-verify="required"
                           autocomplete="off" class="layui-input">
                </div>
            </div>


            <div class="layui-form-item">
                
                <label for="configbase-app_id" class="layui-form-label">
                应用
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="configbase-app_id" name="ConfigBase[app_id]" value="<?=$model->app_id?>" placeholder="请输入应用名" required="" lay-verify="required"
                           autocomplete="off" class="layui-input" >
                </div>
            </div>


            <div class="layui-form-item">                
                <label for="configbase-type" class="layui-form-label">
                配置类型
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="configbase-type" name="ConfigBase[type]" value="<?=$model->type?>" placeholder="请输入类型" required="" lay-verify="required"
                           autocomplete="off" class="layui-input">
                </div>
            </div>


            <div class="layui-form-item">
                <label for="configbase-extra" class="layui-form-label">
                    配置值
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="configbase-extra" name="ConfigBase[extra]" value="<?=$model->extra?>" placeholder="请输入类型值" required="" lay-verify="required"
                           autocomplete="off" class="layui-input">
                </div>
            </div>


            <div class="layui-form-item">
                
                <label for="configbase-description" class="layui-form-label">
                    配置说明
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="configbase-description" name="ConfigBase[description]" value="<?=$model->description?>" placeholder="请输入说明" required="" lay-verify="required"
                           autocomplete="off" class="layui-input">
                </div>
            </div>


            <div class="layui-form-item">                
                <label for="configbase-is_hide_des" class="layui-form-label">
                是否隐藏说明
                </label>
                <div class="layui-input-inline">
                    <select  id="configbase-is_hide_des" name="ConfigBase[is_hide_des]" lay-verify="required">
                        
                        <option value="0" <?=$model->is_hide_des===0?"selected":""?> >否</option>
                        <option value="1" <?=$model->is_hide_des===1?"selected":""?> >是</option>
                    </select>
                    <!-- <input type="text" id="configbase-is_hide_des" name="ConfigBase[is_hide_des]" value="" placeholder="请输入" required="" lay-verify="required"
                           autocomplete="off" class="layui-input"> -->
                </div>
            </div>

            <div class="layui-form-item">                
                <label for="configbase-default_value" class="layui-form-label">
                默认配置
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="configbase-default_value" name="ConfigBase[default_value]" value="<?=$model->default_value?>" placeholder="请输入" required="" lay-verify="required"
                           autocomplete="off" class="layui-input">
                </div>
            </div>

            <div class="layui-form-item">                
                <label for="configbase-sort" class="layui-form-label">
                排序
                </label>
                
                <div class="layui-input-inline">
                    <select  id="configbase-sort" name="ConfigBase[sort]" lay-verify="required">
                        <option value="1" <?=$model->sort===1?"selected":""?>>是</option>
                        <option value="0" <?=$model->sort===0?"selected":""?> >否</option>
                    </select>
                    <!-- <input type="text" id="configbase-sort" name="ConfigBase[sort]" value="" placeholder="请输入" required="" lay-verify="required"
                           autocomplete="off" class="layui-input"> -->
                </div>
            </div>

            <div class="layui-form-item">                
                <label for="configbase-status" class="layui-form-label">
                状态
                </label>
                <div class="layui-input-inline">
                <select  id="configbase-status" name="ConfigBase[status]" lay-verify="required">
                    <option value="1" <?=$model->status===1?"selected":""?> >启用</option>
                    <option value="0" <?=$model->status===0?"selected":""?> >禁用</option>
                    <option value="-1" <?=$model->status===-1?"selected":""?> >删除</option>  
                </select>                    
                </div>
            </div>

            <div class="layui-form-item">
                <label for="L_repass" class="layui-form-label">
                </label>
                <button  class="layui-btn" lay-filter="add" lay-submit="">
                    提交
                </button>
            </div>
        </form>
    </div>
</div>



<?php
$getUnitList = \yii\helpers\Url::toRoute(['get-unit-list']);
$update = \yii\helpers\Url::toRoute(['auth/update-unit-status']);
$_csrfBackend = \Yii::$app->request->csrfToken;
$jsStr = <<<STR
    function(value){
       
    }
STR;
//$jsStr = isset($unitInfo['password_hash']) ? $jsStr : "[/(.+){6,12}$/, '密码必须6到12位']";

$tableJs = <<<JS
    layui.use(['form', 'layer'],function() {
        $ = layui.jquery;  var form = F(layui.form), layer = layui.layer;

        //自定义验证规则
        form.verify({
            name: function(value) {
                if (value.length < 0) {
                    return '请输入昵称';
                }
            }
        });
        //监听提交
        var sFun = function (jsonData) {
                layer.close(load);
                var ic = (jsonData.status == true) ? icon.ICON_OK : icon.ICON_ERROR;
                layer.msg(jsonData.msg,{icon:ic},function () {
                    if(jsonData.status == true){
                        xadmin.father_reload();
                        xadmin.close();                    
                    }
                });
        };
        form.submit('add','',sFun);
    });
JS;
$this->registerJs($tableJs,\yii\web\View::POS_END);
?>





